package cn;

import cn.itcast.Demo;

public enum EMOTIONAL implements  Emotion {
    SECRECY(1, "保密"), SINGLE(2, "单身"), MARRIED(3, "已婚"), DIVORCE(4, "离异");
    private int code;
    private String value;

    private EMOTIONAL(int code, String value) {
        this.code = code;
        this.value = value;
    }
    public int getCode() {
        return code;
    }



    public static int getCode(String value) {
        for (EMOTIONAL emotional : values()) {
            if (emotional.getValue().equals(value)) return emotional.getCode();
        }
        return -1;
    }

    public String getValue() {
        return value;
    }

    public static String getValue(int code) {
        for (EMOTIONAL emotional : values()) {
            if (emotional.getCode() == code) return emotional.getValue();
        }
        return null;
    }

    @Override
    public String toString() {
        return value;
    }

    @Override
    public void info() {
        System.out.println("fuck");
    }
}
